<?php
if (!defined('LEGAL_OPER')){ die('Hacking attempt');}
/**
 * 缓存类
 * tcc1988@163.com
 */
class CacheUtil{
    /**写入缓存**/
	static function put($key,$data){
		FileUtil::mkdirs(ROOT_PATH.'/cache/');
		$fileutil = new FileUtil();
		$fileutil->save(ROOT_PATH.'/cache/'.$key.'.cache',serialize($data));
	}
	/**获取缓存**/
	static function get($key){
		if(file_exists(ROOT_PATH.'/cache/'.$key.'.cache')){
			$fileutil = new FileUtil();
			return unserialize($fileutil->get(ROOT_PATH.'/cache/'.$key.'.cache'));
		}else{
			return null;
		}
	}
}
?>